//
// Created by 11510 on 2024/7/4.
//

#ifndef DAY03_TASKQUEUE_H
#define DAY03_TASKQUEUE_H
#include <iostream>
#include <queue>
#include <mutex>
#include <condition_variable>
using std::unique_lock;
using std::queue;
using std::mutex;
using std::condition_variable;

class TaskQueue {
private:
    size_t _queueSize;
    queue<int> _queue;
    mutex _mutex;
    condition_variable _notFull;
    condition_variable _notEmpty;

public:
    TaskQueue(size_t queueSize);
    ~TaskQueue();
    void push(const int& value);
    int pop();
    bool full() const;
    bool empty() const;
};

#endif //DAY03_TASKQUEUE_H
